﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Windows;
using 立库托盘入库.bean;

namespace 立库托盘入库.ViewModel
{
    class NameViewModel : INotifyPropertyChanged
    { 
        Name _username;
        Visibility _isSampleDialogOpen;
        private ProgressDialog _userContent;
        public NameViewModel()
        {
            _username = new Name() { UserName = "", Password = "" };
            _userContent = new ProgressDialog();
            _isSampleDialogOpen = Visibility.Hidden;
        }

        public String UserName
        {
            get { return _username.UserName; }
            set { _username.UserName = value;
                RaisePropertyChanged("UserName");
            }
        }

        public String PassWord
        {
            get { return _username.Password; }
            set { _username.Password = value;
                RaisePropertyChanged("Password");
            }
        }

        public ProgressDialog UserContent
        {
            get { return _userContent; }
            set
            {
                _userContent = value;
                RaisePropertyChanged("UserContent");
            }
        }

        public Visibility IsSampleDialogOpen
        {
            get { return _isSampleDialogOpen; }
            set
            {
                _isSampleDialogOpen = value;
                RaisePropertyChanged("IsSampleDialogOpen");
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;

        private void RaisePropertyChanged(string PropertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(PropertyName));
            }
        }
    }
}
